class Student {
    //成员变量：定义在方法的外部，类的内部！

    //普通成员变量/实例成员变量
    private String name;//姓名
    private int age;//年龄

    //静态成员变量
    public static String classRoom;

    {
        this.name = "xiaoli";
        this.age = 19;
        System.out.println("实例代码块！");
    }

    static {
        classRoom = "109";
        System.out.println("静态代码块！1");
    }

    static {
        classRoom = "888";
        System.out.println("静态代码块！2");
    }

    public Student() {
        System.out.println("不带参数的构造方法");
    }

    public Student(String name) {
        this.name = name;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
    /**/

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
        //return 写啥都行 返回一个自己定义的值。
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //成员方法
    public void eat() {
        System.out.println(this.name +" 正在吃饭！");
        //this.show();
    }

    public void show() {
        //func();
        System.out.println("姓名："+this.name +" 年龄："+this.age);
    }

    public static void func() {
        System.out.println("这是一个静态方法！！");
        //show(); 静态方法内部 不能直接调用非静态方法
        /*Student student = new Student();
        student.show();*/
    }

}
public class Test {

    public static void main(String[] args) {
       Student.classRoom="109";

        System.out.println(Student.classRoom);


        Student student1 = new Student();
        System.out.println(student1);






        /*System.out.println(Student.classRoom);

        Student student1 = new Student();
        System.out.println("=====");
        Student student2 = new Student();*/
    }


    public static void main6(String[] args) {

        {
            int x = 10;
            System.out.println(x);
        }

        //System.out.println(x);

    }





    public int add(int a,int b) {
        return a+b;
    }

    public static void main4(String[] args) {
        Test test = new Test();
        System.out.println(test.add(1, 2));
    }

    public static void main3(String[] args) {
        /*Student student1 = new Student("A",10);
        student1.classRoom = "109";

        Student student2 = new Student("B",3);
        student2.classRoom = "109";

        Student student3 = new Student("C",15);
        student3.classRoom = "109";
*/
        Student.classRoom ="109";
        System.out.println(Student.classRoom);


        Student.func();

    }


    public static void main2(String[] args) {
        /*int a;
        //System.out.println(a);*/
        Student student = new Student();
        student.setName("zhangfei") ;
        System.out.println(student.getName());
        //Student student2 = new Student("zhangfei",99);

    }


    /*public static void main1(String[] args) {
        Student student = new Student();
        student.name = "zhangsan";
        student.age = 19;
        System.out.println(student.name);
        System.out.println(student.age);
        student.eat();

        Student student2 = new Student();
        student2.name = "lisi";
        student2.age = 5;
        System.out.println(student2.name);
        System.out.println(student2.age);
        student2.eat();
    }*/
}